/**
 * 
 */
package org.vsg.stock.extension.service;

import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.vsg.common.exceptions.service.ServiceException;
import org.vsg.stock.basic.domain.StockDailyLine;
import org.vsg.stock.extension.vo.ExtStockDailyLineVO;
import org.vsg.stock.extension.vo.HistoryPatternStock;
import org.vsg.stock.extension.vo.LinkageStocksItemVO;

/**
 * @author vison
 *
 */
public interface StockHistoryService {
	
	/**
	 * define history pattern 
	 * @param pattern
	 * @return
	 * @throws ServiceException
	 */
	Map<String , List<HistoryPatternStock>> findHistoryPattern(String pattern) throws ServiceException;	
	

	/**
	 * 
	 * @param lines
	 * @param periodicity
	 * @return
	 */
	String getAbstractShapePattern(List<StockDailyLine> lines , int periodicity);
	
	/**
	 * 
	 * @param lines
	 * @param periodicity
	 * @return
	 */
	List<HistoryPatternStock> getAbstractShapePatternData(List<StockDailyLine> lines , int periodicity);
	
	/**
	 * 
	 * @param stockCode
	 * @param startDate
	 * @param cycle
	 * @return
	 * @throws ServiceException
	 */
	String convertToHistoryPattern(String stockCode , Date startDate , int cycle) throws ServiceException;
	
	/**
	 * 
	 * @param refDate
	 * @param overRatio
	 * @return
	 * @throws ServiceException
	 */
	List<ExtStockDailyLineVO> findOverRatioExtStockDailyLineByDate(Date refDate , double overRatio) throws ServiceException;
	
	/**
	 * 
	 * @param orgDir
	 * @param targetIndexDir
	 * @throws ServiceException
	 */
	void buildStockPatternIndex(File orgDir , File targetIndexDir) throws ServiceException;
	
	/**
	 * 
	 * @param orgDir
	 * @param targetIndexDir
	 * @param cycle
	 * @throws ServiceException
	 */
	void buildAverageLineShape(File orgDir , File targetIndexDir , int cycle) throws ServiceException;
	
	/**
	 * 
	 * @param date
	 * @return
	 * @throws ServiceException
	 */
	List<LinkageStocksItemVO> findLinkageStocksItemByDate(Date date) throws ServiceException;
	
	/**
	 * 
	 * @param date
	 * @return
	 * @throws ServiceException
	 */
	List<String> findLinkageStocksDescByDate(Date date) throws ServiceException;

}
